<meta charset="UTF-8">
<style type="text/css">
.modal-header h4{
	font-size: 25px;
}
</style>
<div th:if="${g_tk.size() == 0}">
	<center><img src="static/img/empty.jpg" width="40%"></center>
</div>
<div th:if="${g_tk.size() != 0}">
	<table class="table table-bordered table-hover ">
	<tr>
		<th>申请老师</th>
		<th>申请时间</th>
		<th>上课时间</th>
		<th>星期</th>
		<th>节次</th>
		<th>上课地点</th>
		<th>课程名称</th>
		<th>上课班级</th>
		<th>请假类型</th>
		<th>请假理由</th>
		<th>状态</th>
		<th colspan="2">操作</th>

	</tr>
	<tr th:each="tk:${g_tk}">
		<td th:text="${tk.user.name}"></td>
		<td th:text="${tk.opplyTime}"></td>
		<td th:text="${tk.suspendTime}"></td>
		<td th:text="${tk.week}"></td>
		<td th:text="${tk.section}"></td>
		<td th:text="${tk.classroom}"></td>
		<td th:text="${tk.curriculum}"></td>
		<td th:text="${tk.tbClass}"></td>
		<td th:text="${tk.type}"></td>
		<td th:text="${tk.reason}"></td>
		<!-- <td>
		<img alt="log" th:src="@{/ttb/download/(id=${tk.picture.id})}">
		</td> -->
		<td th:text="${tk.state}"></td>
		<td>
			<button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal" th:title="${tk.id}" th:onclick="g_picture(this.title)"><span class=" glyphicon glyphicon-picture "></span> 佐证材料</button>
			<button class="btn btn-success btn-sm" th:onclick="'javascript:g_agree2(\''+${tk.id}+'\')'"><span class="glyphicon glyphicon-ok"></span>同意</button>
			<button class="btn btn-danger btn-sm" th:onclick="'javascript:g_refuse2(\''+${tk.id}+'\')'"><span class="glyphicon glyphicon-remove"></span>拒绝</button>
		</td>
	</tr>
</table>
</div>

<div class="modal fade bs-example-modal-sm" id="myModal" tabindex="-1" aria-labelledby="myModalLable">
	<div class="modal-dialog modal-lg">
		<div class="modal-content" id="g_picture">
			
		</div>
	</div>
</div>


<script>
function g_picture(id){
	$("#g_picture").load("ttb/g_picture?id="+id)
}
function g_agree2(id){
	bootbox.confirm({
		title:'<span class="glyphicon glyphicon-question-sign"></span> 提示信息',
		message: '<h4>确定同意吗？</h4>',
		buttons: {
            cancel: {
                label: '<i class="glyphicon glyphicon-remove"></i> 取消'
            },
            confirm: {
                label: '<i class="glyphicon glyphicon-ok"></i> 确定'
            }
        },
        callback: function (result) {
        	if(result==true){
        		$.post('ttb/tkController',{id:id, a:1},function(data){
        			$('#g_main').load('ttb/g_adminTtb2');
        			bootbox.alert(data.msg);
        		});
        	}
        }
	});
}
function g_refuse2(id){
	    bootbox.prompt({
	    	locale:'zh_CN',
	    	size: '',
	    	title:'相关意见',
	        inputType: 'textarea',
	        callback: function (result) {
	            if(result != null){
	            	$.post('ttb/tkController',{id:id, a:2, result: result},function(data){
	        			$('#g_main').load('ttb/g_adminTtb2');
	        			bootbox.alert(data.msg);
	        		});
	            }
	        }
	    });
}	
</script>